//
//  BoxTextureTestScene.h
//  Ray Tracer
//
//  Created by Kaila, Ashish on 4/21/13.
//  Copyright (c) 2013 Kaila, Ashish. All rights reserved.
//

#ifndef Ray_Tracer_BoxTextureTestScene_h
#define Ray_Tracer_BoxTextureTestScene_h

void renderBoxTextureTestScene(Raytracer& raytracer,
                               int width,
                               int height,
                               bool enableSpecular)
{
    // Camera parameters.
	Point3D eye(0, 0, 1);
	Vector3D view(0, 0, -1);
	Vector3D up(0, 1, 0);
	double fov = 35;
    
	// Defines a material for shading.
	TextureMaterial gold("box_texture.bmp",
                         Colour(0.5, 0.5, 0.5),
                         51.2,
                         0.5,
                         0,
                         0);
    
    SolidMaterial planeMaterial(Colour(0.83137254901961, 0.83137254901961, 0.83137254901961),
                                Colour(0.83137254901961, 0.83137254901961, 0.83137254901961),
                                Colour(0.3, 0.3, 0.3),
                                10,
                                0,
                                1,
                                0);
    
	// Defines a point light source.
    
    // Defines a point light source.
    double const area = 6;
    
    raytracer.addLightSource(new FiniteLight(Point3D(5, 5, -2.5),
                                             Vector3D(0, 0, -area),
                                             Vector3D(0, area, 0),
                                             10,
                                             Colour(0.9, 0.9, 0.9) ),
                             enableSpecular);
    

    
	raytracer.addLightSource(new PointLight(Point3D(2, 2, 2),
                                            Colour(0.1, 0.1, 0.1)),
                             enableSpecular);
    
    SceneDagNode* plane = raytracer.addObject( new UnitSquare(&planeMaterial));
    double factor1[3] = { 80, 80, 80 };
    SceneObject* planeObj = plane->obj;
	planeObj->translate(Vector3D(0, -0.5, -2));
	planeObj->scale(Point3D(0, 0, 0), factor1);
    planeObj->rotate('x', -90);
    
	// Add a unit square into the scene with material mat.
    CompositeShape* modelShape = ModelFactory::createCompositeShapeFromModel(std::string("cube.3ds"), &gold);
    modelShape->translate(Vector3D(1, 0, -3));
    modelShape->rotate('y', 30);
	raytracer.addObject(modelShape);
    
	// Render the scene, feel free to make the image smaller for
	// testing purposes.
	raytracer.render(width, height, eye, view, up, fov, "box.bmp");
}


#endif
